#ifndef QMEMERYVALUESETDIALOG_H
#define QMEMERYVALUESETDIALOG_H

#include <QDialog>

#include <QTableView>
#include <QPushButton>
#include <QAbstractTableModel>
struct tagMemeryInfo
{
    QString     m_property;
    QString     m_value;
    QString     m_script;
    bool        m_select;
};
class QMemeryModel: public QAbstractTableModel
{
    Q_OBJECT
public:
    QVariant    data(const QModelIndex &index, int role) const;
    bool        setData(const QModelIndex &index, const QVariant &value, int role);
    Qt::ItemFlags   flags(const QModelIndex &index) const;
    int         rowCount(const QModelIndex &parent) const;
    int         columnCount(const QModelIndex &parent) const;
    QVariant    headerData(int section, Qt::Orientation orientation, int role) const;
    int         getSelect();

    QList<tagMemeryInfo>    items();
    void        AddItem(const tagMemeryInfo &info);
public slots:
    void        addItem();
    void        removeSelectItem();

protected:
    QList<tagMemeryInfo>    m_items;
};


class QMemeryValueSetDialog : public QDialog
{
    Q_OBJECT
public:
    QMemeryValueSetDialog(QObject * o,QWidget* parent=0);

    int exec();

    QVariant value();
    void    setValue(const QVariant &v);
protected slots:
    void    ok();
    void    pressed(const QModelIndex &index);
protected:
    QTableView          *m_treeWidget;
    QMemeryModel        *m_model;

    QPushButton         *m_addBtn;
    QPushButton         *m_removeBtn;
    QPushButton         *m_okBtn;

    int                 m_ret;
};

#endif // QMEMERYVALUESETDIALOG_H
